package com.iss.okair.controller.assets;

import com.iss.common.Message;
import com.iss.okair.db.entity.AssetsCar;
import com.iss.okair.db.model.AssetsCarModel;
import com.iss.okair.service.assets.AssetsCarService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
@RestController
@RequestMapping("/logic/assets/car")
public class AssetsCarController {
    @Autowired
    private AssetsCarService service;
    @RequestMapping("/list")
    public List<AssetsCar> find(AssetsCarModel model){
        return service.find(model);
    }

    @RequestMapping("/save")
    //消息提示
    public Message save(AssetsCar assets){
        Message msg = new Message();
        if(service.save(assets)){
            msg.setError(false);
            msg.setMsg("保存成功");
        }else{
            msg.setError(true);
            msg.setMsg("保存失败");
        }
        return msg;
    }
}
